function h=def_draw_player(G,P,k)
% def_draw_player: Default routine to draw the player itself
%
% SYNTAX:
%   h = def_draw_player(G,P,k)
%   Return the handles of graphics objects to represent the player itself.

%   Author: Hongbin Ma
%   Last updated: 2009-6-1 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

%~ h=plot(P.icon_x+P.pos(1),P.icon_y+P.pos(2),P.legend);

if length(P.pos)==3,
  h=plot3(P.pos(1),P.pos(2),P.pos(3),[P.legend,'o']);
  return
end;

ax=axis;
img=P.img;
ico=P.ico;
if isempty(img),
  xx=ico.x*cos(P.ang)-ico.y*sin(P.ang);
  yy=ico.y*cos(P.ang)+ico.x*sin(P.ang);
  x=xx*ico.sx*ico.size/100*(ax(2)-ax(1))+P.pos(1);
  y=yy*ico.sy*ico.size/100*(ax(4)-ax(3))+P.pos(2);
  h=plot(x,y,P.legend);
elseif ~isempty(img),
  x=img.x*img.sx*img.size/100*(ax(2)-ax(1))+P.pos(1);
  y=img.y*img.sy*img.size/100*(ax(4)-ax(3))+P.pos(2);
  h=image(x,y,img.c);
end;
if isempty(P.info),
  return;
elseif isempty(P.info.Position),
  h2=drawinfo(P.info,P.pos);
else,
  h2=drawinfo(P.info);
end;
h=[h,h2];
